<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<html>
<head>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<title>Exported from Notepad++</title>
<style type="text/css">
span {
	font-family: 'Courier New';
	font-size: 10pt;
	color: #000000;
}
.sc0 {
}
.sc2 {
	font-style: italic;
	color: #0000FF;
}
.sc4 {
	color: #8000FF;
}
.sc5 {
	font-weight: bold;
	font-style: italic;
	color: #0000FF;
}
.sc6 {
	font-weight: bold;
	color: #008000;
}
.sc8 {
	font-weight: bold;
	font-style: italic;
	color: #008000;
}
.sc10 {
	font-weight: bold;
	color: #0080FF;
}
.sc11 {
}
.sc14 {
	color: #8080FF;
}
</style>
</head>
<body>
<div style="float: left; white-space: pre; line-height: 1; background: #FFFFFF; "><span class="sc2">// Application pour voir graphiquement une table de vérité.</span><span class="sc0">
</span><span class="sc2">// Compilation : </span><span class="sc0">
</span><span class="sc2">// BPEXTRA='-thread threads.cmxa' bopbuild</span><span class="sc0">

</span><span class="sc10">#</span><span class="sc5">stringargv</span><span class="sc0"> </span><span class="sc11">f</span><span class="sc0">
</span><span class="sc10">#</span><span class="sc5">intargv</span><span class="sc0"> </span><span class="sc8">AD</span><span class="sc0">
</span><span class="sc10">#</span><span class="sc5">intargv</span><span class="sc0"> </span><span class="sc8">WL</span><span class="sc0">

</span><span class="sc2">// #ROM rom (AD, WL) = file("$(f)")</span><span class="sc0">

</span><span class="sc10">#</span><span class="sc6">init</span><span class="sc0"> </span><span class="sc10">%{</span><span class="sc0">
    </span><span class="sc11">open</span><span class="sc0"> </span><span class="sc8">Graphics</span><span class="sc0">

    </span><span class="sc11">let</span><span class="sc0"> </span><span class="sc11">tab_init</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> 
        </span><span class="sc11">let</span><span class="sc0"> </span><span class="sc11">code_brut</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc8">BoolArray</span><span class="sc10">.</span><span class="sc11">of_asci_file</span><span class="sc0"> </span><span class="sc11">_f</span><span class="sc0"> </span><span class="sc11">in</span><span class="sc0">
        </span><span class="sc8">BoolMatrix</span><span class="sc10">.</span><span class="sc11">of_bool_array</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc4">2</span><span class="sc0"> </span><span class="sc10">$$</span><span class="sc0"> </span><span class="sc11">_AD</span><span class="sc10">)</span><span class="sc0"> </span><span class="sc11">_WL</span><span class="sc0"> </span><span class="sc11">code_brut</span><span class="sc10">;;</span><span class="sc0">

    </span><span class="sc11">let</span><span class="sc0"> </span><span class="sc11">_rom</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc11">new</span><span class="sc0"> </span><span class="sc11">rom</span><span class="sc0"> </span><span class="sc11">_f</span><span class="sc0"> </span><span class="sc11">_AD</span><span class="sc0"> </span><span class="sc11">_WL</span><span class="sc0"> </span><span class="sc11">tab_init</span><span class="sc10">;;</span><span class="sc0">

    </span><span class="sc11">open_graph</span><span class="sc0"> </span><span class="sc14">" 300x400"</span><span class="sc10">;;</span><span class="sc0">
    </span><span class="sc11">set_window_title</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc14">"Viewer : "</span><span class="sc10">^</span><span class="sc11">_f</span><span class="sc10">);;</span><span class="sc0">
    </span><span class="sc11">_rom</span><span class="sc10">#</span><span class="sc11">draw</span><span class="sc10">;;</span><span class="sc0">
    </span><span class="sc8">Thread</span><span class="sc10">.</span><span class="sc11">create</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc11">fun</span><span class="sc0"> </span><span class="sc10">()</span><span class="sc0"> </span><span class="sc10">-&gt;</span><span class="sc0"> </span><span class="sc11">_rom</span><span class="sc10">#</span><span class="sc11">main_loop</span><span class="sc0"> </span><span class="sc10">~</span><span class="sc11">loop</span><span class="sc10">:</span><span class="sc11">true</span><span class="sc0"> </span><span class="sc10">())</span><span class="sc0"> </span><span class="sc10">();;</span><span class="sc0">

    </span><span class="sc11">let</span><span class="sc0"> </span><span class="sc11">tmp</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc8">Array</span><span class="sc10">.</span><span class="sc11">make</span><span class="sc0"> </span><span class="sc11">_WL</span><span class="sc0"> </span><span class="sc11">false</span><span class="sc10">;;</span><span class="sc0">
    </span><span class="sc11">let</span><span class="sc0"> </span><span class="sc11">last_read</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc11">ref</span><span class="sc0"> </span><span class="sc4">0</span><span class="sc10">;;</span><span class="sc0">

</span><span class="sc10">}%</span><span class="sc0">

</span><span class="sc10">#</span><span class="sc11">main</span><span class="sc0"> </span><span class="sc11">addr</span><span class="sc10">:[</span><span class="sc8">AD</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc11">word</span><span class="sc10">:[</span><span class="sc8">WL</span><span class="sc10">]</span><span class="sc0">
</span><span class="sc10">#</span><span class="sc5">with</span><span class="sc0"> </span><span class="sc5">code</span><span class="sc0"> </span><span class="sc10">%{</span><span class="sc0">

 </span><span class="sc10">(</span><span class="sc11">*</span><span class="sc0"> </span><span class="sc8">On</span><span class="sc0"> </span><span class="sc11">propose</span><span class="sc0"> </span><span class="sc11">une</span><span class="sc0"> </span><span class="sc11">boucle</span><span class="sc0"> </span><span class="sc11">de</span><span class="sc0"> </span><span class="sc11">lecture</span><span class="sc0"> </span><span class="sc11">sur</span><span class="sc0"> </span><span class="sc11">le</span><span class="sc0"> </span><span class="sc11">terminal</span><span class="sc0"> </span><span class="sc11">*</span><span class="sc10">)</span><span class="sc0">
  </span><span class="sc11">_rom</span><span class="sc10">#</span><span class="sc11">bread</span><span class="sc0"> </span><span class="sc11">addr</span><span class="sc0"> </span><span class="sc11">word</span><span class="sc10">;</span><span class="sc0">
  </span><span class="sc11">_rom</span><span class="sc10">#</span><span class="sc11">reset_color</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc11">!last_read</span><span class="sc10">);</span><span class="sc0">
  </span><span class="sc11">let</span><span class="sc0"> </span><span class="sc11">read</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc11">int_of_bits</span><span class="sc0"> </span><span class="sc11">addr</span><span class="sc0"> </span><span class="sc11">in</span><span class="sc0">
  </span><span class="sc11">_rom</span><span class="sc10">#</span><span class="sc11">set_color</span><span class="sc0"> </span><span class="sc11">read</span><span class="sc0"> </span><span class="sc11">green</span><span class="sc10">;</span><span class="sc0">
  </span><span class="sc11">last_read</span><span class="sc0"> </span><span class="sc10">:=</span><span class="sc0"> </span><span class="sc11">read</span><span class="sc10">;</span><span class="sc0">
  </span><span class="sc11">_rom</span><span class="sc10">#</span><span class="sc11">draw</span><span class="sc0">

</span><span class="sc10">}%</span><span class="sc0">
</span></div></body>
</html>
